package com.lin.blog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lin.blog.entity.ArticleTags;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @program: blog
 * @description: 文章 标签 Mapper对象
 * @author: Lin
 * @create: 2020-04-06 01:24
 **/
public interface ArticleTagsMapper extends BaseMapper<ArticleTags> {

    /**
     * 根据文章ID删除
     * @param articleId
     * @return
     */
    public int deleteByArticleId(Long articleId);

    /**
     * 根据articleId tagsList 拼接SQL批量删除
     * @param articleId
     * @param tagsList
     * @return
     */
    public int deleteBatch(@Param("articleId") Long articleId, @Param("tagsList") List<Long> tagsList);


    /**
     * 根据articleId tagsList 拼接SQL批量添加
     * @param articleId
     * @param tagsList
     * @return
     */
    public int insertBatch(@Param("articleId") Long articleId, @Param("tagsList") List<Long> tagsList);

    /**
     * 根据文章ID获取
     * @param articleId
     * @return
     */
    public List<ArticleTags> getArticleTagListByArticleId(Long articleId);
}
